package com.service.impl;

import com.dao.DeptMapper;
import com.dao.EmpMapper;
import com.entity.Emp;
import com.service.EmpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class EmpServiceImpl implements EmpService {

    @Autowired
    private EmpMapper empMapper;
    @Autowired
    private DeptMapper deptMapper;

    @Override
    public List<Emp> getAll(int pageNum, int pageSize) {

        return empMapper.getAll(pageNum, pageSize);
    }

    @Transactional
    @Override
    public void testTx() {
        empMapper.deleteById();
        deptMapper.insert();
    }
}
